package com.itkm.feignconsumer.config;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class HystrixDashboardConfiguration {
    @Bean
    public ServletRegistrationBean<HystrixMetricsStreamServlet> getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        return new ServletRegistrationBean<HystrixMetricsStreamServlet>(streamServlet){{
            setLoadOnStartup(1);
            addUrlMappings("/hystrix.stream");
            setName("HystrixMetricsStreamServlet");
        }};
    }
}
